<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('订单列表')" />
	<th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								昵称：<input type="text" name="nickNameForSearch"/>
							</li>

							<li>
								手机号码：<input type="text" name="mobileForSearch"/>
							</li>
							<li>
								收货人姓名：<input type="text" name="addressRealname"/>
							</li>

							<!-- <li>
								昵称：<input type="text" name="nickNameForSearch"/>
							</li> -->
							<!-- <li>
								姓名：<input type="text" name="realNameForSearch"/>
							</li> -->



							
							


							<li class="select-selectpicker">
								<label>订单状态： </label><select name="orderShuxin" class="selectpicker" data-none-selected-text="请选择">
									<option value=""></option>
									<option value="2001">待付款</option>
									<option value="2002">待接单</option>
									<option value="2003">待送达</option>
									<option value="2004">待确认</option>	
									<option value="2005">已完成</option>	
									<option value="2006">退款</option>									
								</select>
							</li>

							<li class="select-time">
								<label>订单时间： </label>
								<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
							</li>

							<!-- <li>
								订单属性 待付款2001，待接单2002，待送达2003，待确认2004，已完成2005，退款2006：<input type="text" name="orderShuxin"/>
							</li> -->

							

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()" id="orderFind"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm" id="toolbar" role="group">
				
				<a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="Order:order:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
			
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('Order:order:edit')}]];
        var removeFlag = [[${@permission.hasPermi('Order:order:remove')}]];
        var prefix = ctx + "Order/order";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
				detailUrl: prefix + "/detail/{id}",
                modalName: "订单",
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'id', 
					title : 'id',
					visible: false
				},
				{
					field : 'orderid', 
					title : '订单编号',
					sortable: true
				},
				
				
				{
					title: '订单类型',
				    formatter: function(value, row, index) {
				    	if(row.ifJiadan==1){
				    		return "闪送加单";
				    	} else {
				    		return row.type;
				    	} 
				    }
					},
				
				{
					field : 'addressId', 
					title : '收件地址',
					sortable: true
				},
					{
						field : 'addressRealname',
						title : '收货人',
						sortable: true
					},
				
				{
					field : 'orderShuxin', 
					title : '订单状态',
					sortable: true
				},
				
				{
					field : 'creactDate', 
					title : '创建时间',
					sortable: false
				},
					{
						field: 'riderName',
						title: '骑手姓名',
						sortable: true
					},

					{
						title: '总佣金',
						formatter: function (value, row, index) {
							return Number(row.jine) + Number(row.xiaofei);
						}
					},
				
				
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="orderUpdate(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑订单</a> ');
		            	actions.push('<a class="btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="orderCheck(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看订单</a> ');
		            	actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除订单</a> ');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
        
        
	    
	    function orderUpdate(id) {
        	$.modal.open('编辑订单', prefix + "/edit/" + id, '1300', '800');			
		}
	    
	    function orderCheck(id) {
        	var options = {
   				title: $.table._option.modalName + "详情",
   				width: 1300,
   				height: 800,
   				url: prefix + "/edit/" + id,
   				skin: 'layui-layer-gray', 
   				btn: ['关闭'],
   				yes: function (index, layero) {
   	                layer.close(index);
                }
   			};
        	$.modal.openOptions(options);
        }


	    
	    
	   
	    
	   /*  $(document).ready(function(){
	    	setTimeout("fmPost()",10000)
		    function fmPost(){
		      location.reload();
		    }
	    }) */
	    
	  
	      /* location.reload(); */
	      /* var inputs=document.getElementsByName("refresh");
	      inputs.click(); */
	      /* alert(66); */
	     /*  $('[name="refresh"]').click(); */
	      
	   /*  $(function(){
				setInterval(function(){
				var buy = document.getElementById('orderFind');//给你的a标签加一个id :btnBuy
				buy.click();
				},20000)//后面的500是以毫秒为单位。
		});  */
	    		
    </script>
</body>
</html>